package cn.jolyoulu.common.web.security.config;

import cn.jolyoulu.common.web.security.interceptors.LoginInterceptor;
import cn.jolyoulu.common.web.security.interceptors.UserPermissionInterceptor;
import cn.jolyoulu.common.web.security.interceptors.UserTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author LuZhouJin
 * @Date 2023/3/15
 */
@Configuration
public class SecurityWebConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Autowired
    private UserPermissionInterceptor userPermissionInterceptor;

    @Autowired
    private UserTokenInterceptor userTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userTokenInterceptor);
        registry.addInterceptor(loginInterceptor);
        registry.addInterceptor(userPermissionInterceptor);
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
